home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume89 / devices / net.3 < prev    next >
Internet Message Format  |  1989-09-16  |  52KB

  1. Path: xanth!lll-winken!ames!sun-barr!newstop!sun!swap!page
  2. From: page%swap@Sun.COM (Bob Page)
  3. Newsgroups: comp.sources.amiga
  4. Subject: v89i176:  net - network (net:) device, Part03/04
  5. Message-ID: <124773@sun.Eng.Sun.COM>
  6. Date: 15 Sep 89 07:29:53 GMT
  7. Sender: news@sun.Eng.Sun.COM
  8. Lines: 1647
  9. Approved: page@sun.com
  10.  
  11. Submitted-by: sas!walker@mcnc.org (Doug Walker)
  12. Posting-number: Volume 89, Issue 176
  13. Archive-name: devices/net.3
  14.  
  15. # This is a shell archive.
  16. # Remove anything above and including the cut line.
  17. # Then run the rest of the file through 'sh'.
  18. # Unpacked files will be owned by you and have default permissions.
  19. #----cut here-----cut here-----cut here-----cut here----#
  20. #!/bin/sh
  21. # shar: SHell ARchive
  22. # Run the following text through 'sh' to create:
  23. #    handler/makefile
  24. #    handler/mount.c
  25. #    handler/netdnet.c
  26. #    handler/process.c
  27. #    handler/volume.c
  28. #    iodnet.c
  29. #    netcomm.h
  30. #    netdev.h
  31. #    netdnet.h
  32. #    proto.h
  33. #    request.c
  34. #    sendpkt.c
  35. #    server/device.c
  36. #    server/dir.c
  37. #    server/dispatch.c
  38. #    server/file.c
  39. # This is archive 3 of a 4-part kit.
  40. # This archive created: Fri Sep 15 00:24:32 1989
  41. if `test ! -d handler`
  42. then
  43.   mkdir handler
  44.   echo "mkdir handler"
  45. fi
  46. echo "extracting handler/makefile"
  47. sed 's/^X//' << \SHAR_EOF > handler/makefile
  48. X
  49. X#DEBUG  = -dDEBUG=1
  50. XDEBUG =
  51. X
  52. X#LIBS   = lib:lc.lib lib:amiga.lib define _SysBase = _AbsExecBase
  53. XLIBS   = lib:lc.lib lib:amiga.lib define _SysBase = 4
  54. X
  55. XLC1FLAGS = -cwusf -b -d $(DEBUG) -i/
  56. XLC2FLAGS = -v
  57. X
  58. Xnetdnet-handler:  netdnet-handler.d
  59. X   @blink from $+ to $@ nodebug
  60. X
  61. Xnetser-handler:  netser-handler.d
  62. X   @blink from $+ to $@ nodebug
  63. X
  64. Xnetpar-handler:  netpar-handler.d
  65. X   @blink from $+ to $@ nodebug
  66. X
  67. Xnetsing-handler:  netsing-handler.d
  68. X   @blink from $+ to $@ nodebug
  69. X
  70. Xnetdnet-handler.d:  main.o /subs.o file.o dir.o io.o lock.o process.o\
  71. X                  /sendpkt.o volume.o device.o /request.o mount.o devio.o\
  72. X                  netdnet.o /iodnet.o /dnetlib.o /debug.o /timer.o
  73. X  @echo >ram:tmp.with "from $+"
  74. X  @assign blinkwith:
  75. X  @blink with ram:tmp.with SC SD VERBOSE BATCH to $@ lib $(LIBS)\
  76. X         map netdnet-handler.map hx
  77. X  @protect $@ -e
  78. X
  79. Xnetsing-handler.d:  main.o /subs.o file.o dir.o io.o lock.o process.o\
  80. X                  /sendpkt.o volume.o device.o /request.o mount.o devio.o\
  81. X                  netsing.o iosing.o /debug.o /timer.o
  82. X  @echo >ram:tmp.with "from $+"
  83. X  @assign blinkwith:
  84. X  @blink with ram:tmp.with SC SD VERBOSE BATCH to $@ lib $(LIBS)
  85. X  @protect $@ -e
  86. X
  87. Xnetser-handler.d:  main.o /subs.o file.o dir.o io.o lock.o process.o \
  88. X                 /sendpkt.o volume.o device.o /request.o mount.o devio.o\
  89. X                 netser.o /ioser.o /debug.o /timer.o
  90. X  @echo >ram:tmp.with "from $+"
  91. X  @assign blinkwith:
  92. X  @blink with ram:tmp.with SC SD VERBOSE BATCH to $@ lib $(LIBS)
  93. X  @protect $@ -e
  94. X
  95. Xnetpar-handler.d:  main.o /subs.o file.o dir.o io.o lock.o process.o \
  96. X                 /sendpkt.o volume.o device.o /request.o mount.o devio.o\
  97. X                 netpar.o /iopar.o /debug.o /timer.o
  98. X  @echo >ram:tmp.with "from $+"
  99. X  @assign blinkwith:
  100. X  @blink with ram:tmp.with SC SD VERBOSE BATCH to $@ lib $(LIBS)
  101. X  @protect $@ -e
  102. X
  103. Xmain.o : main.c handler.h /netcomm.h
  104. X @echo "Compiling $<"
  105. X @lc1 -. $(LC1FLAGS) -oram:temp.q $<
  106. X @lc2 -. $(LC2FLAGS) -y -o$@ ram:temp.q
  107. X
  108. X/dnetlib.o : /dnetlib.c
  109. X @echo "Compiling $<"
  110. X @lc1 -. $(LC1FLAGS) -oram:temp.q $<
  111. X @lc2 -. $(LC2FLAGS) -y -o$@ ram:temp.qSHAR_EOF
  112. echo "extracting handler/mount.c"
  113. sed 's/^X//' << \SHAR_EOF > handler/mount.c
  114. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  115. X/* |_o_o|\\ Copyright (c) 1987, 1988 The Software Distillery.  All Rights  */
  116. X/* |. o.| || Reserved.  This program may not be distributed without the    */
  117. X/* | .  | || permission of the authors:                            BBS:    */
  118. X/* | o  | ||   John Toebes     Doug Walker    Dave Baker                   */
  119. X/* |  . |//                                                                */
  120. X/* ======                                                                  */
  121. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  122. X/* Volume Manipulation */
  123. X/* mount */
  124. X#include "handler.h"
  125. X
  126. X/* Define a BCPL volume name as a default */
  127. X#define NETNAME "\7Network"
  128. X
  129. Xvoid DisMount(global)
  130. XGLOBAL global;
  131. X{
  132. X   struct DeviceList *volume;
  133. X   struct DosInfo *info;
  134. X   struct RootNode *root;
  135. X
  136. X   BUG(("Dismount: Entry\n"));
  137. X
  138. X   /* start at the root of the device list */
  139. X   root   = (struct RootNode   *)DOSBase->dl_Root;
  140. X   info   = (struct DosInfo    *)BADDR(root->rn_Info);
  141. X   volume = (struct DeviceList *)BADDR(info->di_DevInfo);
  142. X
  143. X   /* See if we have a current volume that we have to get rid of ? */
  144. X   /* Make sure there are no outstanding locks for the volume */
  145. X   if ((global->volume != NULL) && (global->volume->dl_Lock == NULL))
  146. X      {
  147. X      /* This volume needs to be removed from the list */
  148. X      /* First locate it on the list */
  149. X      Forbid();
  150. X
  151. X      /* is it at the head of the list? */
  152. X      if (volume == global->volume)
  153. X         /* sure enough, just get rid of it */
  154. X         info->di_DevInfo = volume->dl_Next;
  155. X      else
  156. X         {
  157. X         /* Find it in the list */
  158. X         while(volume != NULL &&
  159. X            (struct DeviceList *)(BADDR(volume->dl_Next)) != global->volume)
  160. X            volume = (struct DeviceList *)BADDR(volume->dl_Next);
  161. X
  162. X         /* if we found it then take it out of the chain */
  163. X         if (volume != NULL)
  164. X            volume->dl_Next = global->volume->dl_Next;
  165. X         }
  166. X      Permit();
  167. X
  168. X      if (global->volume)
  169. X         {
  170. X         DosFreeMem((char *)global->volume);
  171. X         }
  172. X      }
  173. X
  174. X   global->volume = NULL;
  175. X}
  176. X
  177. Xvoid Mount(global, name)
  178. XGLOBAL global;
  179. Xchar *name;
  180. X{
  181. X   struct DeviceList *volume;
  182. X   struct DosInfo *info;
  183. X   struct RootNode *root;
  184. X   short newlen; /* Cause memcmp to use the most efficient code */
  185. X
  186. X   BUGP("Mount: Entry")
  187. X   BUG(("Mount: Entry\n"));
  188. X
  189. X   global->n.ErrorCount = 0;
  190. X
  191. X   if(name == NULL) name = NETNAME;
  192. X   newlen = *name + 1;
  193. X
  194. X   /* Now find it on the device list. */
  195. X   /* First start at the root of the device list */
  196. X   root   = (struct RootNode   *)DOSBase->dl_Root;
  197. X   info   = (struct DosInfo    *)BADDR(root->rn_Info);
  198. X   volume = (struct DeviceList *)BADDR(info->di_DevInfo);
  199. X
  200. X   BUGBSTR("Volume name is : ", name);
  201. X
  202. X   /* Can't let the system change the list underneath us...        */
  203. X   Forbid();
  204. X   
  205. X   /* Now run through the list until we come up empty OR we find it */
  206. X   while(volume != NULL)
  207. X      {
  208. X      if (volume->dl_Type == DLT_VOLUME                               &&
  209. X          !memcmp(name, (char *)BADDR(volume->dl_Name), newlen)    &&
  210. X          volume->dl_VolumeDate.ds_Days   == 0L                       &&
  211. X          volume->dl_VolumeDate.ds_Minute == 0L                       &&
  212. X          volume->dl_VolumeDate.ds_Tick   == 0L)
  213. X         break;
  214. X      volume = (struct DeviceList *)BADDR(volume->dl_Next);
  215. X      }
  216. X
  217. X   Permit();
  218. X
  219. X   BUG(("mount: Volume is %08lx\n", volume));
  220. X
  221. X   /* OK, now did we find it? */
  222. X   if (volume != NULL)
  223. X      {
  224. X      BUGP("Got volume")
  225. X      BUG(("Got a matching node\n"));
  226. X
  227. X      /* Sure did, We probably need to check to see if another handler has */
  228. X      /* it to work with, but for now we assume only onw such volume can   */
  229. X      /* exist.  This was a problem with all but the latest version of 1.2 */
  230. X      /* If we have write access, we should probably nudge the ticks by one*/
  231. X      /* just to make it unique                                            */
  232. X      }
  233. X   else
  234. X      /* No such volume is known to the system.  So we will just have to   */
  235. X      /* allocate a node to put everything on.                             */
  236. X      {
  237. X      BUGP("No volume")
  238. X      volume = (struct DeviceList *)
  239. X               DosAllocMem(global, sizeof(struct DeviceList)+newlen);
  240. X
  241. X      BUG(("Created new node at %08lx\n", volume));
  242. X
  243. X      /* Note that volume+1 gets us to the extra memory we allocated.  */
  244. X      /* Just a lot simpler to write that in C than ...+sizeof(...)    */
  245. X      MQ(name, (char *)(volume + 1), newlen);
  246. X      volume->dl_VolumeDate.ds_Days   = 3800L;
  247. X      volume->dl_VolumeDate.ds_Minute = 
  248. X      volume->dl_VolumeDate.ds_Tick   = 0L;
  249. X      volume->dl_Name = (BSTR)MKBADDR((volume + 1));
  250. X      volume->dl_Lock = NULL;
  251. X      volume->dl_Type = DLT_VOLUME;
  252. X
  253. X      /* Also we need to link it into the list */
  254. X      Forbid();
  255. X      volume->dl_Next = info->di_DevInfo;
  256. X      info->di_DevInfo = MKBADDR(volume);
  257. X      Permit();
  258. X      }
  259. X
  260. X   /* Now we can own the volume by giving it our task id */
  261. X   volume->dl_Task = global->n.port;
  262. X   volume->dl_DiskType = ID_DOS_DISK;
  263. X
  264. X   /* all set up, remember what our base volume is */
  265. X   global->volume = volume;
  266. X
  267. X   BUGP("Mount: Exit")
  268. X}
  269. X
  270. SHAR_EOF
  271. echo "extracting handler/netdnet.c"
  272. sed 's/^X//' << \SHAR_EOF > handler/netdnet.c
  273. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  274. X* |_o_o|\\ Copyright (c) 1988 The Software Distillery.  All Rights Reserved *
  275. X* |. o.| ||          Written by Doug Walker                                 *
  276. X* | .  | ||          The Software Distillery                                *
  277. X* | o  | ||          235 Trillingham Lane                                   *
  278. X* |  . |//           Cary, NC 27513                                         *
  279. X* ======             BBS:(919)-471-6436                                     *
  280. X\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  281. X
  282. X#include "netdnet.h"
  283. X#include "handler.h"
  284. X
  285. X#ifdef CPR
  286. Xchar *dbgwind = "CON:0/0/640/160/NETDNET-HANDLER/a";
  287. X#endif
  288. X
  289. X#if 1
  290. X
  291. Xint ReSync(global, ioptr)
  292. XGLOBAL global;
  293. XAPTR ioptr;
  294. X{
  295. X   TermRDevice(global, 1);
  296. X   return(InitRDevice(global));
  297. X}
  298. X
  299. X#else
  300. X
  301. Xint ReSync(global, ioptr)
  302. XGLOBAL global;
  303. XAPTR ioptr;
  304. X{
  305. X   return(1);
  306. X}
  307. X
  308. X#endif
  309. X
  310. Xint InitRDevice(global)
  311. XGLOBAL global;
  312. X{
  313. X   struct MsgPort *chan;
  314. X   struct NetNode *tmpnode;
  315. X   struct RPacket RP;
  316. X   static doinit = 1;
  317. X
  318. X   if(!doinit) 
  319. X   {
  320. X      BUG(("InitRDevice: Init loop, exiting\n"))
  321. X      return(1);
  322. X   }
  323. X
  324. X   doinit = 0;
  325. X
  326. X   BUG(("InitRDevice: Initializing for DNET operation on unit %d\n",
  327. X        global->unitnum));
  328. X
  329. X   BUGP("InitRDevice: Entry")
  330. X
  331. X   if(!(chan=DOpen(NULL, (uword)(PORT_FHANDLER), 20, 15)))
  332. X   {
  333. X      BUG(("********ERROR: Can't DOpen!!\n"));
  334. X      BUGR("Can't open channel!")
  335. X   }
  336. X   if(chan) DQueue((struct DChannel *)chan, 32);/* Is this really necessary? */
  337. X   BUG(("DNET Channel %lx open\n", chan));
  338. X
  339. X   if(!global->netchain.next)
  340. X   {
  341. X      if(tmpnode=AddNode(global, "\3Foo", (APTR)chan))
  342. X         strcpy(tmpnode->devname, "ROOT:");
  343. X   }
  344. X   else if(chan)
  345. X   {
  346. X      /* Preserve state of global->RP */
  347. X       memcpy((char *)&RP, (char *)&global->RP, sizeof(struct RPacket));
  348. X
  349. X      for(tmpnode=global->netchain.next; tmpnode; tmpnode=tmpnode->next)
  350. X      {
  351. X         BUG(("ReSync: Trying to resync '%s'\n", tmpnode->devname))
  352. X   
  353. X         global->RP.Type = ACTION_NETWORK_KLUDGE;
  354. X         strcpy(global->RP.Data, tmpnode->devname);
  355. X         global->RP.DLen = strlen(global->RP.Data);
  356. X         tmpnode->RootLock.RDevice = (RPTR)1L;
  357. X         tmpnode->ioptr = (APTR)chan;
  358. X         tmpnode->status = NODE_UP;
  359. X         if(RemotePacket(global, &tmpnode->RootLock))
  360. X         {
  361. X            tmpnode->status = NODE_CRASHED;
  362. X            BUG(("ReSync: Failed\n"))
  363. X         }
  364. X      }
  365. X      memcpy((char *)&global->RP, (char *)&RP, sizeof(struct RPacket));
  366. X   }
  367. X
  368. X
  369. X   doinit = 1;
  370. X
  371. X   BUGP("InitRDevice: Exit")
  372. X
  373. X   return(chan != NULL);
  374. X}
  375. X
  376. Xint TermRDevice(global, status)
  377. XGLOBAL global;
  378. Xint status;
  379. X{
  380. X   struct NetNode *netnode;
  381. X
  382. X   for(netnode=global->netchain.next; netnode; netnode=netnode->next)
  383. X   {
  384. X      if(netnode->ioptr)
  385. X      {
  386. X         netnode->status = NODE_DEAD;
  387. X         if(!status) DClose((struct DChannel *)netnode->ioptr);
  388. X         netnode->ioptr = NULL;
  389. X      }
  390. X   }
  391. X
  392. X   return(0);
  393. X}
  394. X
  395. Xvoid ActNetHello(global, pkt)
  396. XGLOBAL global;
  397. Xstruct DosPacket *pkt;
  398. X{
  399. X}
  400. SHAR_EOF
  401. echo "extracting handler/process.c"
  402. sed 's/^X//' << \SHAR_EOF > handler/process.c
  403. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  404. X/* |_o_o|\\ Copyright (c) 1987, 1988 The Software Distillery.  All Rights  */
  405. X/* |. o.| || Reserved.  This program may not be distributed without the    */
  406. X/* | .  | || permission of the authors:                            BBS:    */
  407. X/* | o  | ||   John Toebes     Doug Walker    Dave Baker                   */
  408. X/* |  . |//                                                                */
  409. X/* ======                                                                  */
  410. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  411. X/* Process Control */
  412. X
  413. X/* ActDie ActInhibit ActFlush ActTimer */
  414. X#include "handler.h"
  415. X
  416. Xvoid ActDie(global, pkt)
  417. XGLOBAL global;
  418. Xstruct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  419. X{
  420. X   struct NetNode *netnode;
  421. X   BUG(("ActDie\n"));
  422. X   global->n.run = 0;
  423. X   global->RP.Type = pkt->dp_Type;
  424. X
  425. X   for(netnode=global->netchain.next; netnode; netnode=netnode->next)
  426. X   {
  427. X      if(netnode->status == NODE_UP && netnode->RootLock.RDevice)
  428. X      {
  429. X         BUGBSTR("Shutting down node ", netnode->name);
  430. X         RemotePacket(global, &netnode->RootLock);
  431. X         netnode->status = NODE_DEAD;
  432. X      }
  433. X   }
  434. X}
  435. X
  436. Xvoid ActInhibit(global, pkt)
  437. XGLOBAL global;
  438. Xstruct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  439. X{
  440. X   BUG(("ActInhibit: %ld\n", pkt->dp_Arg1));
  441. X   pkt->dp_Res1 = DOS_TRUE;
  442. X   if(pkt->dp_Arg1 == 0)
  443. X   {
  444. X      /* Since the DISKCHANGE command uses ACTION_INHIBIT instead of */
  445. X      /* ACTION_DISK_CHANGE, do a ACTION_DISK_CHANGE just in case    */
  446. X      ActDiskChange(global, pkt);
  447. X   }
  448. X}
  449. X
  450. Xvoid ActFlush(global, pkt)
  451. XGLOBAL global;
  452. Xstruct DosPacket *pkt;
  453. X{
  454. X   BUG(("ActFlush\n"));
  455. X}
  456. X
  457. X#if 0
  458. Xvoid ActTimer(global, pkt)
  459. XGLOBAL global;
  460. Xstruct DosPacket *pkt;        /* a pointer to the dos packet sent */
  461. X{
  462. X   BUG(("ActTimer\n"));
  463. X
  464. X   if (global->run == -1)
  465. X      global->run = 0;
  466. X   else
  467. X      PostTimerReq(global);
  468. X
  469. X   /* Prevent them from replying to the message */
  470. X   global->reply = 0;
  471. X}
  472. X#endif
  473. SHAR_EOF
  474. echo "extracting handler/volume.c"
  475. sed 's/^X//' << \SHAR_EOF > handler/volume.c
  476. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  477. X/* |_o_o|\\ Copyright (c) 1987, 1988 The Software Distillery.  All Rights  */
  478. X/* |. o.| || Reserved.  This program may not be distributed without the    */
  479. X/* | .  | || permission of the authors:                            BBS:    */
  480. X/* | o  | ||   John Toebes     Doug Walker    Dave Baker                   */
  481. X/* |  . |//                                                                */
  482. X/* ======                                                                  */
  483. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  484. X/* Volume Manipulation */
  485. X/* ActCurentVol  ActRenameDisk ActDiskInfo ActInfo ActDiskChange*/
  486. X
  487. X#include "handler.h"
  488. X
  489. Xstatic void GetInfo U_ARGS((GLOBAL, struct DosPacket *, struct InfoData *));
  490. X
  491. Xvoid ActCurentVol(global, pkt)
  492. XGLOBAL global;
  493. Xstruct DosPacket *pkt;              /* a pointer to the dos packet sent    */
  494. X{
  495. X   BUG(("ActCurentVol\n"));
  496. X   pkt->dp_Res1 = MKBADDR(global->volume);
  497. X}
  498. X
  499. Xvoid ActRenameDisk(global, pkt)
  500. XGLOBAL global;
  501. Xstruct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  502. X{
  503. X   BUG(("ActRenameDisk\n"));
  504. X
  505. X   DisMount(global);
  506. X   Mount(global, (char *)pkt->dp_Arg1);
  507. X
  508. X   pkt->dp_Res1 = DOS_TRUE;
  509. X}
  510. X
  511. Xvoid GetInfo(global, pkt, info)
  512. XGLOBAL global;
  513. Xstruct DosPacket *pkt;
  514. Xstruct InfoData *info;
  515. X{
  516. X   BUG(("GetInfo\n"));
  517. X
  518. X   if(global->volume == NULL)
  519. X   {
  520. X      info->id_DiskType = ID_NO_DISK_PRESENT;
  521. X      pkt->dp_Res1 = DOS_FALSE;
  522. X   }
  523. X   else
  524. X   {
  525. X      info->id_NumSoftErrors = global->n.ErrorCount;
  526. X      info->id_UnitNumber = global->unitnum;
  527. X      if(global->upnodes>1)
  528. X      {
  529. X         info->id_DiskState = ID_VALIDATED;
  530. X         info->id_DiskType  = ID_DOS_DISK;
  531. X      }
  532. X      else
  533. X      {
  534. X         info->id_DiskState = ID_VALIDATING;
  535. X         info->id_DiskType  = ID_NO_DISK_PRESENT;
  536. X      }
  537. X      info->id_NumBlocks = global->numnodes;
  538. X      info->id_NumBlocksUsed = global->upnodes;
  539. X      info->id_VolumeNode = MKBADDR(global->volume);
  540. X      info->id_InUse = 0;
  541. X      pkt->dp_Res1 = DOS_TRUE;
  542. X   }
  543. X   BUG(("GetInfo: Exit\n"));
  544. X}
  545. X
  546. Xvoid ActDiskInfo(global, pkt)
  547. XGLOBAL global;
  548. Xstruct DosPacket *pkt;
  549. X{
  550. X   BUG(("ActDiskInfo\n"));
  551. X   GetInfo(global, pkt, (struct InfoData *)pkt->dp_Arg1);
  552. X}
  553. X
  554. Xvoid ActInfo(global, pkt)
  555. XGLOBAL global;
  556. Xstruct DosPacket *pkt;              /* a pointer to the dos packet sent    */
  557. X{
  558. X   struct FileLock *flock;
  559. X   NETPTR nlock;
  560. X
  561. X   BUG(("ActInfo\n"));
  562. X
  563. X   flock = (struct FileLock *)pkt->dp_Arg1;
  564. X
  565. X   if(flock == NULL || flock->fl_Volume != MKBADDR(global->volume) ||
  566. X      (nlock=(NETPTR)flock->fl_Key)->RPtr == NULL)
  567. X      GetInfo(global, pkt, (struct InfoData *)pkt->dp_Arg2);
  568. X   else
  569. X   {
  570. X      /* It is a remote lock - query the remote fs */
  571. X      global->RP.Type = pkt->dp_Type;
  572. X      global->RP.Arg1 = (LONG)nlock->RPtr;
  573. X      global->RP.DLen = 0;
  574. X   
  575. X      if(!RemotePacket(global, nlock))
  576. X         MQ(global->RP.Data, pkt->dp_Arg2, sizeof(struct InfoData));
  577. X   }
  578. X}
  579. X
  580. Xvoid ActNetKludge(global, pkt)
  581. XGLOBAL global;
  582. Xstruct DosPacket *pkt;
  583. X{
  584. X   struct NetNode *netnode;
  585. X   /* Arg1: BPTR to null-terminated BCPL string of name of network node */
  586. X   /* Arg2: BPTR to null-terminated string of name of device to use     */
  587. X
  588. X   global->RP.Type = ACTION_NETWORK_KLUDGE;
  589. X   strcpy(global->RP.Data, (char *)pkt->dp_Arg2);
  590. X   global->RP.DLen = strlen((char *)pkt->dp_Arg2);
  591. X   if(!(netnode = FindNode(global, (char *)pkt->dp_Arg1+1)) &&
  592. X       global->netchain.next)
  593. X   {
  594. X      BUG(("ActNetKludge: Adding node %s len %d\n", 
  595. X         pkt->dp_Arg1+1, (int)*((unsigned char *)pkt->dp_Arg1)));
  596. X
  597. X      if(netnode=AddNode(global, 
  598. X             (char *)pkt->dp_Arg1, global->netchain.next->ioptr))
  599. X         strcpy(netnode->devname, (char *)pkt->dp_Arg2);
  600. X   }
  601. X   else if(netnode->status != NODE_UP)
  602. X      ReSync(global, netnode->ioptr);
  603. X
  604. X   if(!netnode || netnode->status != NODE_UP || !netnode->RootLock.RDevice)
  605. X   {
  606. X      BUG(("ActNetKludge: node %s netnode %08lx unavailable\n", 
  607. X         pkt->dp_Arg1, netnode));
  608. X      pkt->dp_Res1 = DOS_FALSE;
  609. X      pkt->dp_Res2 = ERROR_NODE_DOWN;
  610. X   }
  611. X   else 
  612. X      if(RemotePacket(global, &netnode->RootLock))
  613. X         netnode->status = NODE_CRASHED;
  614. X}
  615. X
  616. Xvoid ActDiskChange(global, pkt)
  617. XGLOBAL global;
  618. Xstruct DosPacket *pkt;
  619. X{
  620. X   BUG(("ActDiskChange\n"));
  621. X}
  622. SHAR_EOF
  623. echo "extracting iodnet.c"
  624. sed 's/^X//' << \SHAR_EOF > iodnet.c
  625. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  626. X* |_o_o|\\ Copyright (c) 1988 The Software Distillery.  All Rights Reserved *
  627. X* |. o.| ||          Written by Doug Walker                                 *
  628. X* | .  | ||          The Software Distillery                                *
  629. X* | o  | ||          235 Trillingham Lane                                   *
  630. X* |  . |//           Cary, NC 27513                                         *
  631. X* ======             BBS:(919)-471-6436                                     *
  632. X\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  633. X#define NETCOMMON
  634. X#include "netdnet.h"
  635. X#include "netcomm.h"
  636. X#include "proto.h"
  637. X
  638. Xint PutRPacket(global, ioptr)
  639. XNGLOBAL global;
  640. XAPTR ioptr;
  641. X{
  642. X   int len;
  643. X
  644. X   BUG(("PutRPacket: type %d, Args %lx %lx %lx %lx\n", global->RP.Type, 
  645. X       global->RP.Arg1, global->RP.Arg2, 
  646. X       global->RP.Arg3, global->RP.Arg4));
  647. X
  648. X
  649. XTOP:
  650. X   BUG(("PutRPacket: writing %d to %lx. . .", RPSIZE, ioptr));
  651. X   if((len=DWrite((struct DChannel *)ioptr,
  652. X                   (char *)&global->RP, RPSIZE)) != RPSIZE)
  653. X   {
  654. X      BUG(("**********ERROR - wrote %d instead\n", len));
  655. X      BUGR("Write error");
  656. X      if(ReSync(global, ioptr)) return(1);
  657. X      else goto TOP;
  658. X   }
  659. X   BUG(("%d written\n", len));
  660. X
  661. X   if(global->RP.DLen)
  662. X   {
  663. X      BUG(("PutRPacket: writing %d to %lx. . .", global->RP.DLen, ioptr));
  664. X      if((len=DWrite((struct DChannel *)ioptr,
  665. X                     global->RP.Data, global->RP.DLen)) != global->RP.DLen)
  666. X      {
  667. X         BUG(("**********ERROR - wrote %d instead\n", len));
  668. X         BUGR("Write error 2");
  669. X         if(ReSync(global, ioptr)) return(1);
  670. X         else goto TOP;
  671. X      }
  672. X      BUG(("%d written\n", len));
  673. X   }
  674. X
  675. X   if(global->n.infoport)
  676. X   {
  677. X      struct Message *m;
  678. X      while(m=GetMsg(global->n.ntirec.m.mn_ReplyPort))
  679. X      {
  680. X         if(m == &global->n.ntirec.m)
  681. X            global->n.inuse_rec = 0;
  682. X         else
  683. X            global->n.inuse_trans = 0;
  684. X      }
  685. X      global->n.inf_trans += RPSIZE + global->RP.DLen;
  686. X         
  687. X      if(!global->n.inuse_trans)
  688. X      {
  689. X         BUG(("PutRPacket: Writing status info to port %lx: TRANSMIT %ld\n", 
  690. X            global->n.infoport, global->n.inf_trans))
  691. X
  692. X         global->n.ntitrans.nti_bytes = global->n.inf_trans;
  693. X         global->n.ntitrans.nti_direction = NTI_TRANSMIT;
  694. X         PutMsg(global->n.infoport, &global->n.ntitrans.m);
  695. X
  696. X         global->n.inuse_trans = 1;
  697. X         global->n.inf_trans = 0;
  698. X      }
  699. X#if DEBUG
  700. X      else
  701. X         BUG(("PutRPacket: Skipping status write, packet outstanding\n"))
  702. X#endif
  703. X   }
  704. X
  705. X   return(0);
  706. X}
  707. X
  708. Xint GetRPacket(global, ioptr)
  709. XNGLOBAL global;
  710. XAPTR ioptr;
  711. X{
  712. X   int len;
  713. X
  714. X   BUG(("GetRPacket: reading %d from %lx. . .", RPSIZE, ioptr));
  715. X
  716. XTOP:
  717. X   if((len=DRead((struct DChannel *)ioptr, 
  718. X                 (char *)&global->RP, RPSIZE)) != RPSIZE)
  719. X   {
  720. X      BUG(("**********ERROR - read %d instead\n", len));
  721. X      BUGR("Read error")
  722. X      if(ReSync(global, ioptr)) return(1);
  723. X      else goto TOP;
  724. X   }
  725. X
  726. X   BUG(("type %d, Args %lx %lx %lx %lx\n", global->RP.Type, 
  727. X       global->RP.Arg1, global->RP.Arg2, 
  728. X       global->RP.Arg3, global->RP.Arg4));
  729. X
  730. X   if(global->RP.DLen > 0) 
  731. X   {
  732. X      BUG(("Reading %d more. . .", global->RP.DLen));
  733. X      if((len=DRead((struct DChannel *)ioptr, 
  734. X             global->RP.Data, global->RP.DLen)) != global->RP.DLen)
  735. X      {
  736. X         BUG(("**********ERROR - read %d instead\n", len));
  737. X         BUGR("Read error 2")
  738. X         if(ReSync(global, ioptr)) return(1);
  739. X         else goto TOP;
  740. X      }
  741. X   }
  742. X   else
  743. X      global->RP.Data[0] = '\0';
  744. X
  745. X   BUG(("Done\n"))
  746. X
  747. X   if(global->n.infoport)
  748. X   {
  749. X      struct Message *m;
  750. X      while(m=GetMsg(global->n.ntirec.m.mn_ReplyPort))
  751. X      {
  752. X         if(m == &global->n.ntirec.m)
  753. X            global->n.inuse_rec = 0;
  754. X         else
  755. X            global->n.inuse_trans = 0;
  756. X      }
  757. X      global->n.inf_rec += RPSIZE + global->RP.DLen;
  758. X         
  759. X      if(!global->n.inuse_rec)
  760. X      {
  761. X         BUG(("GetRPacket: Writing status info to port %lx: RECEIVE %ld\n",
  762. X            global->n.infoport, global->n.inf_rec))
  763. X
  764. X         global->n.ntirec.nti_bytes = global->n.inf_rec;
  765. X         global->n.ntirec.nti_direction = NTI_RECEIVE;
  766. X         PutMsg(global->n.infoport, &global->n.ntirec.m);
  767. X
  768. X         global->n.inuse_rec = 1;
  769. X         global->n.inf_rec = 0;
  770. X      }
  771. X#if DEBUG
  772. X      else
  773. X         BUG(("GetRPacket: Skipping status write, packet outstanding\n"))
  774. X#endif
  775. X   }
  776. X
  777. X   return(0);
  778. X}
  779. X
  780. SHAR_EOF
  781. echo "extracting netcomm.h"
  782. sed 's/^X//' << \SHAR_EOF > netcomm.h
  783. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  784. X/* |_o_o|\\ Copyright (c) 1988, 1989 The Software Distillery.  All Rights  */
  785. X/* |. o.| || Reserved.  This program may not be distributed without the    */
  786. X/* | .  | || permission of the authors:                            BBS:    */
  787. X/* | o  | ||   John Toebes     Doug Walker    Dave Baker                   */
  788. X/* |  . |//                                                                */
  789. X/* ======                                                                  */
  790. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  791. X
  792. X
  793. X/* If PARANOID is defined >0, requesters will pop up for debugging */
  794. X/* during the startup.  No need to define it unless we die before  */
  795. X/* getting far enough to start up debugging.                       */
  796. X
  797. X#define PARANOID 0
  798. X
  799. X/* Defining CPR >0 will link in code to do a busy wait when the CPRWAIT */
  800. X/* debug packet is received.  This allows CPR to catch the NET: task    */
  801. X/* and lets us proceed with debugging;  if we are WAITing when CPR      */
  802. X/* catches us, we're dead in the water.                                 */
  803. X#define CPR 0
  804. X
  805. X/* Defining DEBUG >0 will link in code to print stuff to any debugging  */
  806. X/* filehandles provided us by HANDD.  This slows us down quite a bit    */
  807. X/* since the BUG macros all call a subroutine to print their messages   */
  808. X/* even if we aren't debugging anything at the moment.                  */
  809. X
  810. X#ifdef DEBUG
  811. X#undef DEBUG
  812. X#endif
  813. X
  814. X#define DEBUG 0
  815. X
  816. X
  817. X/* The NOEXT define is set by the including .c program to prevent system */
  818. X/* include files from being reincluded here.  It is only used in dnetlib */
  819. X#ifndef NOEXT
  820. X#include <exec/types.h>
  821. X#include <exec/nodes.h>
  822. X#include <exec/lists.h>
  823. X#include <exec/ports.h>
  824. X#include <exec/libraries.h>
  825. X#include <exec/devices.h>
  826. X#include <exec/io.h>
  827. X#include <exec/memory.h>
  828. X#include <exec/interrupts.h>
  829. X#include <intuition/intuition.h>
  830. X#include <devices/console.h>
  831. X#include <devices/timer.h>
  832. X#include <libraries/dos.h>
  833. X#include <libraries/dosextens.h>
  834. X#include <libraries/filehandler.h>
  835. X#include <string.h>
  836. X#include <stdlib.h>
  837. X#ifdef MANX
  838. X#define U_ARGS(a) ()    /* No support for prototypes - oh well */
  839. X#else
  840. X#define U_ARGS(a) a     /* prototype checking to ensure all is well */
  841. X#include <proto/exec.h>
  842. X#include <proto/dos.h>
  843. X#include <proto/timer.h>
  844. X#endif
  845. X#endif
  846. X
  847. X#ifndef min
  848. X#define min(a,b) ((a)<(b)?(a):(b))
  849. X#endif
  850. X
  851. X/* A macro to make good SAS Institute programmers feel at home */
  852. X#define MQ(f,t,l) memcpy((char *)t,(char *)f,(int)l);
  853. X
  854. X#define MBSTR(f,t) memcpy((char *)t,(char *)f,(int)(*((char *)f))+1);
  855. X#define BSTRLEN(s) ((int)(*((char *)(s))))
  856. X
  857. X#undef GLOBAL
  858. X/* my version of BADDR() has no problems with casting */
  859. X#undef  BADDR
  860. X#define BADDR(x)        ((APTR)((long)x << 2))
  861. X#define MKBADDR(x)      ((BPTR)((long)x >> 2))
  862. X
  863. X/* Define a few packet types that may not be in the system include files */
  864. X
  865. X#ifdef ACTION_END
  866. X#undef ACTION_END
  867. X#endif
  868. X#ifdef ACTION_SEEK
  869. X#undef ACTION_SEEK
  870. X#endif
  871. X
  872. X#define ACTION_FIND_WRITE       1004L
  873. X#define ACTION_FIND_INPUT       1005L /* please refer to DOS Tech. Ref. */
  874. X#define ACTION_FIND_OUTPUT      1006L
  875. X#define ACTION_END              1007L
  876. X#define ACTION_SEEK             1008L
  877. X#ifndef ACTION_MORE_CACHE
  878. X#define ACTION_MORE_CACHE       18L
  879. X#endif
  880. X#ifndef ACTION_FLUSH
  881. X#define ACTION_FLUSH            27L
  882. X#endif
  883. X#define ACTION_SET_FILE_DATE    34L
  884. X#define ACTION_SET_RAW_MODE     994L
  885. X
  886. X/* Private packets */
  887. X#define ACTION_HANDLER_DEBUG    2010L
  888. X#define ACTION_SET_TRANS_TYPE   2011L
  889. X#define ACTION_NETWORK_HELLO    2012L
  890. X
  891. X
  892. X#define ACTION_NETWORK_KLUDGE   4674764L   /* Temporary until ROOT: done */
  893. X
  894. X
  895. X#define ERROR_NODE_DOWN   ERROR_OBJECT_NOT_FOUND
  896. X
  897. X#define DOS_FALSE        0L
  898. X#define DOS_TRUE        -1L           /* BCPL "TRUE" */
  899. X
  900. Xtypedef char *RPTR;    /* Pointer to remote node's memory    */
  901. X
  902. Xtypedef int (*fptr)();
  903. X
  904. X#define RNAMELEN 16    /* Max 16 byte names for remote nodes */
  905. X
  906. Xtypedef struct TimerPacket {
  907. X   struct timerequest tm_req;
  908. X   struct DosPacket   tm_pkt;
  909. X};
  910. X
  911. X
  912. X/* Define a struct to communicate with the NETSTAT program */
  913. X#define NTI_TRANSMIT 0 
  914. X#define NTI_RECEIVE  1
  915. X
  916. Xstruct NetTransInfo
  917. X{
  918. X   struct Message m;
  919. X   long nti_bytes;      /* Number of bytes since last request */
  920. X   int  nti_direction;  /* NTI_TRANSMIT or NTI_RECEIVE        */
  921. X};
  922. X
  923. X/* The following defines the network buffer size.  Reads/writes larger */
  924. X/* than this amount will be broken up into smaller chunks.             */
  925. X/* Really should be set by querying the other side.                    */
  926. X#define NETBUFSIZE 1024   /* Maximum amount of meaningful data to send */
  927. X#define FILENAMELEN 120  /* Length of a filename */
  928. X
  929. Xstruct RPacket       /* Packet sent to remote node */
  930. X{
  931. X   LONG Type;          /* Type of request (AmigaDos packet type)       */
  932. X   RPTR RDevice;       /* Pointer to remote MsgPort to send packet to  */
  933. X   LONG Arg1,          /* Equivalent to dp_Arg? in normal devices      */
  934. X        Arg2,          /* when transmitting, dp_Res? when receiving    */
  935. X        Arg3,
  936. X        Arg4;
  937. X   long DLen;          /* Length of data in Data buffer                */
  938. X   char Data[NETBUFSIZE]; /* Data buffer                               */
  939. X};
  940. X
  941. X#define RPSIZE (sizeof(struct RPacket) - NETBUFSIZE)
  942. X
  943. Xstruct NetGlobal
  944. X{
  945. X   struct Process       *self;       /* my process                         */
  946. X   struct MsgPort       *port;       /* our message port                   */
  947. X   struct MsgPort       *devport;    /* msg port for device io             */
  948. X   struct MsgPort       *infoport;   /* msg port for device status info    */
  949. X   struct TimerPacket   *timerpkt;   /* pkt used for timer request         */
  950. X   APTR                 devptr;      /* Device-defined                     */
  951. X   int    run;                       /* flag to continue running           */
  952. X   int    reply;                     /* flag to inhibit replying to message*/
  953. X   long   ErrorCount;                /* Error count for current volume     */
  954. X   short  histimeout;                /* Other side's timeout length        */
  955. X   short  mytimeout;                 /* My timeout length                  */
  956. X   char   *devname;                  /* pointer to device name             */
  957. X   /* These are the fields of the autorequest structure we want to create  */
  958. X   struct IntuiText line1;           /* Top Line of requester              */
  959. X   struct IntuiText line2;           /* Second Line of requester           */
  960. X   struct IntuiText line3;           /* Bottom Line of requester           */
  961. X   struct IntuiText retrytxt;        /* Retry information                  */
  962. X   struct IntuiText canceltxt;       /* CANCEL information                 */
  963. X   char   buf3[16];                  /* Buffer to hold unit information    */
  964. X   int    inuse_trans, inuse_rec;    /* NetTransInfo struct is in use      */
  965. X   long   inf_trans, inf_rec;        /* Bytes trans & rec while nti in use */
  966. X   struct NetTransInfo ntirec;       /* Send receive info to stat window   */
  967. X   struct NetTransInfo ntitrans;     /* Send transmit info to stat window  */
  968. X   union /* Union of driver-specific data - max one entry per driver */
  969. X   {
  970. X      struct MsgPort *LisPort;  /* For DNET protocol                   */
  971. X   } d;
  972. X};
  973. X
  974. Xtypedef struct
  975. X{
  976. X   struct NetGlobal n;
  977. X   struct RPacket RP;
  978. X   struct DosPacket     *pkt;        /* the packet we are processing       */
  979. X} *NGLOBAL;
  980. X
  981. SHAR_EOF
  982. echo "extracting netdev.h"
  983. sed 's/^X//' << \SHAR_EOF > netdev.h
  984. X
  985. X/************************************************************************
  986. X*                                                                       *
  987. X*    Copyright (C) 1989, The Software Distillery.  All Rights Reserved. *
  988. X*                                                                       *
  989. X************************************************************************/
  990. X
  991. X
  992. X
  993. X#ifndef DEVICES_NETDEV_H
  994. X#define DEVICES_NETDEV_H
  995. X
  996. X#ifndef EXEC_IO_H
  997. X#include "exec/io.h"
  998. X#endif !EXEC_IO_H
  999. X
  1000. X#ifndef EXEC_DEVICES_H
  1001. X#include "exec/devices.h"
  1002. X#endif !EXEC_DEVICES_H
  1003. X
  1004. X
  1005. X
  1006. X/*
  1007. X *--------------------------------------------------------------------
  1008. X *
  1009. X * Driver Specific Commands
  1010. X *
  1011. X *--------------------------------------------------------------------
  1012. X */
  1013. X
  1014. X#define CHF_HANDLER (1<<15)              /* for internal use only! */
  1015. X#define CHF_SERVER  (1<<14)              /* for internal use only! */
  1016. X
  1017. X/*
  1018. X *--------------------------------------------------------------------
  1019. X *
  1020. X * Commands with the CHF_HANDLER bit set are only allowed on the handler
  1021. X * unit.  Reads and Writes with the handler bit set can only be
  1022. X * satisfied by Writes or Reads from the remote node with the CHF_SERVER
  1023. X * bit set.
  1024. X *
  1025. X *--------------------------------------------------------------------
  1026. X */
  1027. X#define HCH_READ         (CMD_READ|CHF_HANDLER) /* Read data from a server*/
  1028. X#define HCH_WRITE        (CMD_WRITE|CHF_HANDLER)/* Write data to a server */
  1029. X
  1030. X#define HCH_ATTACH       ((CMD_NONSTD+0)|CHF_HANDLER) /* Attach to new server */
  1031. X#define HCH_DETACH       ((CMD_NONSTD+1)|CHF_HANDLER) /* Detach from a server */
  1032. X#define HCH_STATUS       ((CMD_NONSTD+2)|CHF_HANDLER) /* Give node status     */
  1033. X#define HCH_ADDCHANGEINT ((CMD_NONSTD+3)|CHF_HANDLER) /* Install softint      */
  1034. X#define HCH_REMCHANGEINT ((CMD_NONSTD+4)|CHF_HANDLER) /* Remove softint set   */
  1035. X                                                      /*  by ADDCHANGEINT     */
  1036. X
  1037. X/*
  1038. X *--------------------------------------------------------------------
  1039. X *
  1040. X * Commands with the CHF_SERVER bit set are only allowed on the server  
  1041. X * unit.  Writes with the server bit set can only be satisfied by Reads  
  1042. X * from the node specified in the io_Offset field that have the          
  1043. X * CHF_HANDLER bit set.  Reads with the server bit set are posted with an
  1044. X * io_Offset of -1 specified, and may be satisfied by a write with the   
  1045. X * CHF_HANDLER bit set from any node.                                    
  1046. X *
  1047. X *--------------------------------------------------------------------
  1048. X */
  1049. X#define SCH_READ         (CMD_READ|CHF_SERVER)  /* Read data from a handler */
  1050. X#define SCH_WRITE        (CMD_WRITE|CHF_SERVER) /* Write data to a server */
  1051. X#define SCH_NAME         (CMD_NONSTD+5|CHF_SERVER) /* Set new name        */
  1052. X
  1053. X/*
  1054. X *--------------------------------------------------------------------
  1055. X *
  1056. X * Predefined unit numbers  :
  1057. X * Handlers open the CHU_HANDLER unit; servers open the CHU_SERVER
  1058. X * unit.  Commands with the CHF_HANDLER bit set are valid only on
  1059. X * the handler unit; commands with the CHF_SERVER bit set are valid
  1060. X * only on the server unit.
  1061. X *
  1062. X *--------------------------------------------------------------------
  1063. X */
  1064. X
  1065. X#define CHU_HANDLER -1   /* Handler unit number */
  1066. X#define CHU_SERVER  -2   /* Server unit number  */
  1067. X
  1068. X/*
  1069. X *--------------------------------------------------------------------
  1070. X *
  1071. X * Driver error defines
  1072. X *
  1073. X *--------------------------------------------------------------------
  1074. X */
  1075. X
  1076. X#define CHERR_NotSpecified  41  /* general catchall */
  1077. X#define CHERR_BadNodeID     42  /* Invalid node ID passed */
  1078. X#define CHERR_NodeDown      43  /* Specified node is down */
  1079. X#define CHERR_UnitInUse     44  /* Unit number in use */
  1080. X#define CHERR_BadRequest    45  /* IO request invalid or unknown */
  1081. X#define CHERR_IOErr         46  /* Physical I/O failure */
  1082. X#define CHERR_NameConflict  47  /* Name set request failed */
  1083. X                                        
  1084. X#endif DEVICES_COMMHAND_H
  1085. SHAR_EOF
  1086. echo "extracting netdnet.h"
  1087. sed 's/^X//' << \SHAR_EOF > netdnet.h
  1088. X#ifndef NET_DNET
  1089. X#define NET_DNET
  1090. X
  1091. X#include "dnet.h"
  1092. X
  1093. X#define STDFNLEN  0 
  1094. X
  1095. X#define PORT_FHANDLER 9492
  1096. X
  1097. X#define DNETTIMEOUT 2  /* tenths of a second */
  1098. X
  1099. X#endif
  1100. X
  1101. X
  1102. SHAR_EOF
  1103. echo "extracting proto.h"
  1104. sed 's/^X//' << \SHAR_EOF > proto.h
  1105. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1106. X/* |_o_o|\\ Copyright (c) 1987, 1988 The Software Distillery.  All Rights  */
  1107. X/* |. o.| || Reserved.  This program may not be distributed without the    */
  1108. X/* | .  | || permission of the authors:                            BBS:    */
  1109. X/* | o  | ||   John Toebes     Doug Walker    Dave Baker                   */
  1110. X/* |  . |//                                                                */
  1111. X/* ======                                                                  */
  1112. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1113. X
  1114. X#ifdef NETCOMMON
  1115. X#define GLOBAL NGLOBAL
  1116. X#endif
  1117. X
  1118. Xvoid cprwait    U_ARGS((GLOBAL));
  1119. X
  1120. X#if PARANOID
  1121. Xextern int paranoid;
  1122. X#define BUGP(x) if(paranoid) paranoid=request(global, REQ_GENERAL, x);
  1123. X#else
  1124. X#define BUGP(x)
  1125. X#endif
  1126. X
  1127. X#if CPR
  1128. X/* Debugging routines */
  1129. Xvoid myputbstr  U_ARGS((char *, ...));
  1130. Xvoid myputlstr  U_ARGS((char *, ...));
  1131. Xvoid myprintf   U_ARGS((char *, ...));
  1132. Xvoid xwrite     U_ARGS((char *, int));
  1133. Xvoid xgetcr     U_ARGS((void));
  1134. Xint sprintf     U_ARGS((char *, char *, ...));
  1135. Xvoid mydump     U_ARGS((char *, int));
  1136. XBPTR initdebug  U_ARGS((BPTR));
  1137. Xvoid termdebug  U_ARGS((void));
  1138. X
  1139. X#if DEBUG
  1140. X#define BUG(a) myprintf a;
  1141. X#define BUGBSTR(a,b) myputbstr(a,b);
  1142. X#define BUGLSTR(a,b,c) myputlstr(a,b,c);
  1143. X#define BUGGETC xgetcr();
  1144. X#define BUGTERM() termdebug();
  1145. X#define BUGR(x) request(global, REQ_GENERAL, x);
  1146. X
  1147. X#else
  1148. X
  1149. X#define BUG(a)
  1150. X#define BUGBSTR(a,b)
  1151. X#define BUGLSTR(a,b,c)
  1152. X#define BUGGETC
  1153. X#define BUGTERM()
  1154. X#define BUGR(x)
  1155. X#endif
  1156. X
  1157. X#else
  1158. X
  1159. X#define BUG(a)
  1160. X#define BUGBSTR(a,b)
  1161. X#define BUGLSTR(a,b,c)
  1162. X#define BUGGETC
  1163. X#define BUGTERM()
  1164. X#define BUGR(x)
  1165. X#endif
  1166. X
  1167. Xextern struct DosLibrary *DOSBase;
  1168. X#define alloc(a,b) DosAllocMem(a,b)
  1169. X#define free(p) DosFreeMem(p)
  1170. X
  1171. X/* io#?.c */
  1172. Xint PutRPacket  U_ARGS((GLOBAL, APTR));
  1173. Xint GetRPacket   U_ARGS((GLOBAL, APTR));
  1174. X
  1175. X/* Subs.c */
  1176. Xstruct DosPacket *taskwait     U_ARGS((GLOBAL));
  1177. Xvoid retpkt       U_ARGS((GLOBAL, struct DosPacket *));
  1178. Xchar *DosAllocMem U_ARGS((GLOBAL, long));
  1179. Xvoid DosFreeMem   U_ARGS((char *));
  1180. Xlong sendpkt U_ARGS((struct MsgPort *, long, long*, long));
  1181. XLONG checksum U_ARGS((char *, int));
  1182. Xvoid CheckRP U_ARGS((struct RPacket *));
  1183. X
  1184. X/* pause.c */
  1185. Xint Pause U_ARGS((ULONG));
  1186. X
  1187. X/* net#?.c */
  1188. Xint ReSync         U_ARGS((GLOBAL, APTR));
  1189. X
  1190. X/* timer.c */
  1191. Xint OpenTimer U_ARGS((GLOBAL, struct MsgPort *));
  1192. Xvoid CloseTimer U_ARGS((GLOBAL));
  1193. Xvoid PostTimerReq U_ARGS((GLOBAL, int));
  1194. X
  1195. X/* request.c */
  1196. Xint  request         U_ARGS((GLOBAL, int, char *));
  1197. X#define REQ_MUST    0
  1198. X#define REQ_ERROR   1
  1199. X#define REQ_GENERAL 2
  1200. SHAR_EOF
  1201. echo "extracting request.c"
  1202. sed 's/^X//' << \SHAR_EOF > request.c
  1203. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1204. X/* |_o_o|\\ Copyright (c) 1988 The Software Distillery.  All Rights Reserved */
  1205. X/* |. o.| || This program may not be distributed without the permission of   */
  1206. X/* | .  | || the authors:                             BBS: (919) 481-6436    */
  1207. X/* | o  | ||   John Toebes     John Mainwaring    Jim Cooper                 */
  1208. X/* |  . |//    Bruce Drake     Gordon Keener      Dave Baker                 */
  1209. X/* ======                                                                    */
  1210. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1211. X
  1212. X#define NETCOMMON
  1213. X#include "netcomm.h"
  1214. X#include "proto.h"
  1215. X#include <proto/intuition.h>
  1216. X
  1217. Xint request(global, reqnum, msg)
  1218. XNGLOBAL global;
  1219. Xint reqnum;
  1220. Xchar *msg;
  1221. X{
  1222. X/* Possible requesters that we can see at this time */
  1223. X/* 1: 
  1224. X      You MUST replace volume
  1225. X       xxxxx
  1226. X      in Unit 0 !!!
  1227. X
  1228. X   2: I/O Error on volume
  1229. X       xxxxx
  1230. X      in Unit 0
  1231. X
  1232. X   ?: Unknown Error with volume
  1233. X       xxxxx
  1234. X      in Unit 0
  1235. X*/
  1236. X
  1237. X#if 0
  1238. X   if (global->volume == NULL)
  1239. X#endif
  1240. X      {
  1241. X      *(long *)&global->n.line3.LeftEdge     = 0x0004000EL;  /* 4,4  */
  1242. X      global->n.line1.NextText = &global->n.line2;
  1243. X      }
  1244. X#if 0
  1245. X   else
  1246. X      {
  1247. X      global->n.line1.NextText = &global->n.line2;
  1248. X      global->n.line2.IText = (UBYTE *)BADDR(global->volume->dl_Name)+1;
  1249. X      global->n.line2.NextText = &global->n.line3;
  1250. X      }
  1251. X#endif
  1252. X   global->n.line3.IText = (UBYTE *)&global->n.buf3;
  1253. X   *(long *)&global->n.buf3[0] = ('i'<<24)|('n'<<16)|(' '<<8)|'U';
  1254. X   *(long *)&global->n.buf3[4] = ('n'<<24)|('i'<<16)|('t'<<8)|' ';
  1255. X   *(long *)&global->n.buf3[8] = ('0'<<24)|(' '<<16)|('!'<<8)|'!';
  1256. X   /*global->n.buf3[8] += global->unitnum;*/
  1257. X   global->n.buf3[12] = 0;
  1258. X
  1259. X   switch(reqnum)
  1260. X      {
  1261. X      case REQ_MUST:
  1262. X         global->n.line1.IText = "You MUST replace volume";
  1263. X         break;
  1264. X      case REQ_ERROR:
  1265. X         global->n.line1.IText = "I/O Error on volume";
  1266. X         global->n.buf3[9] = 0;
  1267. X         break;
  1268. X      case REQ_GENERAL:
  1269. X         global->n.line1.IText = msg;
  1270. X         global->n.buf3[9] = 0;
  1271. X         break;
  1272. X      default:
  1273. X         global->n.line1.IText = "Unknown error on volume";
  1274. X         break;
  1275. X      }
  1276. X
  1277. X   /* Now we need to put up the requester */
  1278. X   if (IntuitionBase == NULL)
  1279. X      IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0);
  1280. X   /* We probably should check and put up an alert.. but later on that */
  1281. X
  1282. X   /* Now display the requester */
  1283. X   return(AutoRequest(NULL, &global->n.line1,
  1284. X                            &global->n.retrytxt,   &global->n.canceltxt,
  1285. X                            DISKINSERTED,        0,
  1286. X                            320,                 72));
  1287. X}
  1288. X
  1289. X
  1290. SHAR_EOF
  1291. echo "extracting sendpkt.c"
  1292. sed 's/^X//' << \SHAR_EOF > sendpkt.c
  1293. X/* From: ConPackets.c -  C. Scheppner, A. Finkel, P. Lindsay  CBM
  1294. X *   DOS packet example
  1295. X *   Requires 1.2
  1296. X * 
  1297. X */
  1298. X#include <exec/types.h>
  1299. X#include <exec/ports.h>
  1300. X#include <exec/memory.h>
  1301. X#include <libraries/dos.h>
  1302. X#include <libraries/dosextens.h>
  1303. X#include <proto/exec.h>
  1304. X#include <proto/dos.h>
  1305. X
  1306. XLONG sendpkt(struct MsgPort *, LONG, LONG *, LONG);
  1307. X
  1308. XLONG sendpkt(pid,action,args,nargs)
  1309. Xstruct MsgPort *pid;  /* process indentifier ... (handlers message port ) */
  1310. XLONG action,          /* packet type ... (what you want handler to do )   */
  1311. X     args[],          /* a pointer to a argument list */
  1312. X     nargs;           /* number of arguments in list  */
  1313. X   {
  1314. X   struct MsgPort        *replyport;
  1315. X   struct StandardPacket *packet;
  1316. X   LONG  count, *pargs, res1;
  1317. X
  1318. X   replyport = (struct MsgPort *) CreatePort(NULL,0);
  1319. X   if(!replyport) return(NULL);
  1320. X
  1321. X   packet = (struct StandardPacket *) 
  1322. X      AllocMem((long)sizeof(struct StandardPacket),MEMF_PUBLIC|MEMF_CLEAR);
  1323. X   if(!packet) 
  1324. X      {
  1325. X      DeletePort(replyport);
  1326. X      return(NULL);
  1327. X      }
  1328. X
  1329. X   packet->sp_Msg.mn_Node.ln_Name = (char *)&(packet->sp_Pkt);
  1330. X   packet->sp_Pkt.dp_Link         = &(packet->sp_Msg);
  1331. X   packet->sp_Pkt.dp_Port         = replyport;
  1332. X   packet->sp_Pkt.dp_Type         = action;
  1333. X
  1334. X   /* copy the args into the packet */
  1335. X   pargs = &(packet->sp_Pkt.dp_Arg1);       /* address of first argument */
  1336. X   for(count=0;count < nargs;count++) 
  1337. X      pargs[count]=args[count];
  1338. X   PutMsg(pid,(struct Message *)packet); /* send packet */
  1339. X
  1340. X   WaitPort(replyport);
  1341. X   GetMsg(replyport); 
  1342. X
  1343. X   res1 = packet->sp_Pkt.dp_Res1;
  1344. X
  1345. X   FreeMem((char *)packet,(long)sizeof(struct StandardPacket));
  1346. X   DeletePort(replyport); 
  1347. X
  1348. X   return(res1);
  1349. X}
  1350. SHAR_EOF
  1351. if `test ! -d server`
  1352. then
  1353.   mkdir server
  1354.   echo "mkdir server"
  1355. fi
  1356. echo "extracting server/device.c"
  1357. sed 's/^X//' << \SHAR_EOF > server/device.c
  1358. X/* Device.c - Device support routines */
  1359. X
  1360. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1361. X/* |_o_o|\\ Copyright (c) 1987 The Software Distillery. All Rights Reserved*/
  1362. X/* |. o.| || This program may not be distributed without the permission of */
  1363. X/* | .  | || the author.                                           BBS:    */
  1364. X/* | o  | ||   John Toebes    Dave Baker                     (919)-471-6436*/
  1365. X/* |  . |//                                                                */
  1366. X/* ======                                                                  */
  1367. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1368. X
  1369. X#include "server.h"
  1370. X
  1371. Xint InitDevice(global)
  1372. XGLOBAL global;
  1373. X{
  1374. X   int rc;
  1375. X   struct StandardPacket *sp;
  1376. X   BUGP("InitDevice: Entry")
  1377. X   BUG(("InitDevice: Entry\n"));
  1378. X
  1379. X   if ((global->n.devport = (struct MsgPort *)CreatePort(NULL,0))==NULL)
  1380. X   {
  1381. X      BUG(("********CreatePort Failed\n"));
  1382. X      BUGR("Can't init server")
  1383. X      return(1);        /* error in createport */
  1384. X   }  
  1385. X
  1386. X   if(!(sp = global->stdpkt = (struct StandardPacket *)
  1387. X      AllocMem(sizeof(struct StandardPacket),MEMF_CLEAR)))
  1388. X   {
  1389. X      BUG(("********Couldn't allocate StandardPacket!!\n"));
  1390. X      BUGR("No memory!")
  1391. X      return(1);
  1392. X   }
  1393. X   sp->sp_Msg.mn_Node.ln_Name = (char *)(global->pkt= &(sp->sp_Pkt));
  1394. X   sp->sp_Pkt.dp_Link = &(sp->sp_Msg);
  1395. X
  1396. X   if(!(global->dosport=(struct MsgPort *)DeviceProc("ROOT:")) &&
  1397. X      !(global->dosport=(struct MsgPort *)DeviceProc("SYS:")))
  1398. X   {
  1399. X      BUG(("********DeviceProc of ROOT: and SYS: Failed\n"));
  1400. X      BUGR("No DeviceProc")
  1401. X      return(1);
  1402. X   }
  1403. X   global->RP.RDevice = (RPTR)global->dosport;
  1404. X
  1405. X   OpenTimer(global, global->n.port);
  1406. X
  1407. X   rc = InitRDevice(global);
  1408. X
  1409. X   BUGP("InitDevice: Exit")
  1410. X   return(rc);
  1411. X}
  1412. X
  1413. Xint TermDevice(global)
  1414. XGLOBAL global;
  1415. X{
  1416. X   CloseTimer(global);
  1417. X   TermRDevice(global);
  1418. X   return(1);
  1419. X}
  1420. X
  1421. Xvoid RmtDie(global, pkt)
  1422. XGLOBAL global;
  1423. Xstruct DosPacket *pkt;
  1424. X{
  1425. X   if(--global->n.run == 1) global->n.run = 0;
  1426. X}
  1427. SHAR_EOF
  1428. echo "extracting server/dir.c"
  1429. sed 's/^X//' << \SHAR_EOF > server/dir.c
  1430. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1431. X/* |_o_o|\\ Copyright (c) 1987, 1988 The Software Distillery.  All Rights  */
  1432. X/* |. o.| || Reserved.  This program may not be distributed without the    */
  1433. X/* | .  | || permission of the authors:                            BBS:    */
  1434. X/* | o  | ||   John Toebes     Doug Walker    Dave Baker                   */
  1435. X/* |  . |//                                                                */
  1436. X/* ======                                                                  */
  1437. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1438. X/* Directory Manipulation */
  1439. X/*  RmtCreateDir RmtExamine RmtExNext RmtParent */
  1440. X#include "server.h"
  1441. X
  1442. Xvoid RmtCreateDir(global,pkt)
  1443. XGLOBAL global;
  1444. Xstruct DosPacket *pkt;
  1445. X/* Arg1 - Lock */
  1446. X/* Arg2 - name */
  1447. X/* Arg3 (optional) Attributes */
  1448. X{
  1449. X   BUG(("RmtCreateDir\n"));
  1450. X   BUGBSTR("Creating directory '%s'\n", global->RP.Data);
  1451. X
  1452. X   pkt->dp_Arg1 = global->RP.Arg1;
  1453. X   MBSTR(global->RP.Data, global->fib);
  1454. X   pkt->dp_Arg2 = (LONG)MKBADDR(global->fib);
  1455. X   pkt->dp_Arg3 = global->RP.Arg3;
  1456. X
  1457. X   Dispatch(global);
  1458. X
  1459. X   global->RP.DLen = 0;
  1460. X}
  1461. X
  1462. Xvoid RmtExamine(global, pkt)
  1463. XGLOBAL global;
  1464. Xstruct DosPacket *pkt;
  1465. X/* Arg1: Lock of object to examine */
  1466. X/* Arg2: FileInfoBlock to fill in */
  1467. X{
  1468. X#if DEBUG
  1469. X   struct FileInfoBlock *fib;
  1470. X#endif
  1471. X   BUG(("RmtExamine/RmtExNext - lock %lx\n", global->RP.Arg1));
  1472. X
  1473. X   pkt->dp_Arg1 = global->RP.Arg1;
  1474. X   pkt->dp_Arg2 = (LONG)MKBADDR(global->fib);
  1475. X   MQ(global->RP.Data, global->fib, sizeof(struct FileInfoBlock));
  1476. X
  1477. X   Dispatch(global);
  1478. X
  1479. X#if DEBUG
  1480. X   fib = (struct FileInfoBlock *)global->fib;
  1481. X   BUG(("RmtEx: FIB name='%s' size=%ld numblocks=%ld\n", 
  1482. X      fib->fib_FileName+1, fib->fib_Size, fib->fib_NumBlocks));
  1483. X#endif
  1484. X
  1485. X   MQ(global->fib, global->RP.Data, sizeof(struct FileInfoBlock));
  1486. X
  1487. X   global->RP.DLen = sizeof(struct FileInfoBlock);
  1488. X}
  1489. X
  1490. Xvoid RmtParent(global,pkt)
  1491. XGLOBAL global;
  1492. Xstruct DosPacket *pkt;
  1493. X/* Arg1 - Lock */
  1494. X{
  1495. X   BUG(("RmtParent\n"));
  1496. X
  1497. X   pkt->dp_Arg1 = global->RP.Arg1;
  1498. X
  1499. X   Dispatch(global);
  1500. X
  1501. X   global->RP.DLen = 0;
  1502. X}
  1503. X
  1504. SHAR_EOF
  1505. echo "extracting server/dispatch.c"
  1506. sed 's/^X//' << \SHAR_EOF > server/dispatch.c
  1507. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
  1508. X* |_o_o|\\ Copyright (c) 1988 The Software Distillery.  All Rights Reserved *
  1509. X* |. o.| ||          Written by Doug Walker                                 *
  1510. X* | .  | ||          The Software Distillery                                *
  1511. X* | o  | ||          235 Trillingham Lane                                   *
  1512. X* |  . |//           Cary, NC 27513                                         *
  1513. X* ======             BBS:(919)-471-6436                                     *
  1514. X\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1515. X
  1516. X#include "server.h"
  1517. X
  1518. Xvoid Dispatch(global)
  1519. XGLOBAL global;
  1520. X{
  1521. X   BUG(("Dispatch: Entry\n"))
  1522. X
  1523. X   /* This must be done each time - do not try to move it to InitDevice */
  1524. X   global->stdpkt->sp_Pkt.dp_Port = global->n.port;
  1525. X
  1526. X#if 1
  1527. X   if(global->RP.RDevice == NULL || global->RP.RDevice == (RPTR)1)
  1528. X      global->RP.RDevice = (RPTR)global->dosport;
  1529. X   PutMsg((struct MsgPort *)global->RP.RDevice, 
  1530. X          (struct Message *)global->stdpkt);
  1531. X#else
  1532. X   PutMsg(global->dosport, (struct Message *)global->stdpkt);
  1533. X#endif
  1534. X
  1535. X   WaitPort(global->n.port);
  1536. X
  1537. X   GetMsg(global->n.port);
  1538. X
  1539. X   BUG(("Dispatch: local RC = %lx, %lx\n", 
  1540. X         global->pkt->dp_Res1, global->pkt->dp_Res2));
  1541. X   global->RP.Arg1 = global->pkt->dp_Res1;
  1542. X   global->RP.Arg2 = global->pkt->dp_Res2;
  1543. X
  1544. X   return;
  1545. X}SHAR_EOF
  1546. echo "extracting server/file.c"
  1547. sed 's/^X//' << \SHAR_EOF > server/file.c
  1548. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1549. X/* |_o_o|\\ Copyright (c) 1987, 1988 The Software Distillery.  All Rights  */
  1550. X/* |. o.| || Reserved.  This program may not be distributed without the    */
  1551. X/* | .  | || permission of the authors:                            BBS:    */
  1552. X/* | o  | ||   John Toebes     Doug Walker    Dave Baker                   */
  1553. X/* |  . |//                                                                */
  1554. X/* ======                                                                  */
  1555. X/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  1556. X/* File Manipulation  */
  1557. X/*  ActDelete ActRename ActSetProtection ActSetComment */
  1558. X#include "server.h"
  1559. X
  1560. Xvoid RmtDelete(global, pkt)
  1561. XGLOBAL global;
  1562. Xstruct DosPacket *pkt;              /* a pointer to the dos packet sent   */
  1563. X/* Arg1: Lock    */
  1564. X/* Arg2: Name    */
  1565. X{
  1566. X   BUG(("RmtDelete, lock %lx\n", global->RP.Arg1));
  1567. X   BUGBSTR("File to delete is ", global->RP.Data);
  1568. X
  1569. X   pkt->dp_Arg1 = global->RP.Arg1;
  1570. X   MBSTR(global->RP.Data, global->fib);
  1571. X   pkt->dp_Arg2 = (LONG)MKBADDR(global->fib);
  1572. X
  1573. X   Dispatch(global);
  1574. X
  1575. X   global->RP.DLen = 0;
  1576. X}
  1577. X
  1578. Xvoid RmtRename(global,pkt)
  1579. XGLOBAL global;
  1580. Xstruct DosPacket *pkt;
  1581. X/* Arg1: FromLock    */
  1582. X/* Arg2: FromName    */
  1583. X/* Arg3: ToLock        */
  1584. X/* Arg4: ToName        */
  1585. X{
  1586. X   char *name;
  1587. X   BUG(("RmtRename\n"));
  1588. X   BUGBSTR("Renaming ", global->RP.Data);
  1589. X   BUGBSTR("New Name ", global->RP.Data+FILENAMELEN);
  1590. X
  1591. X   pkt->dp_Arg1 = global->RP.Arg1;
  1592. X   MBSTR(global->RP.Data, global->fib);
  1593. X   pkt->dp_Arg2 = (LONG)MKBADDR(global->fib);
  1594. X   pkt->dp_Arg3 = global->RP.Arg3;
  1595. X   name = ((char *)global->fib)+FILENAMELEN;
  1596. X   MBSTR(global->RP.Data+FILENAMELEN, name);
  1597. X   pkt->dp_Arg4 = (LONG)MKBADDR(name);
  1598. X
  1599. X   Dispatch(global);
  1600. X
  1601. X   global->RP.DLen = 0;
  1602. X}
  1603. X
  1604. Xvoid RmtSetProtection(global, pkt)
  1605. XGLOBAL global;
  1606. Xstruct DosPacket *pkt;
  1607. X/* Arg1: Unused */
  1608. X/* Arg2: Lock */
  1609. X/* Arg3: Name */
  1610. X/* Arg4: Mask of protection */
  1611. X{
  1612. X   BUG(("RmtSetProtection\n"));
  1613. X
  1614. X   BUGBSTR("File to protect: ", global->RP.Data);
  1615. X
  1616. X   pkt->dp_Arg2 = global->RP.Arg2;
  1617. X   MBSTR(global->RP.Data, global->fib);
  1618. X   pkt->dp_Arg3 = (LONG)MKBADDR(global->fib);
  1619. X   pkt->dp_Arg4 = global->RP.Arg4;
  1620. X
  1621. X   Dispatch(global);
  1622. X
  1623. X   global->RP.DLen = 0;
  1624. X}
  1625. X
  1626. Xvoid RmtSetComment(global,pkt)
  1627. XGLOBAL global;
  1628. Xstruct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  1629. X/* Arg1: Unused */
  1630. X/* Arg2: Lock */
  1631. X/* Arg3: Name */
  1632. X/* Arg4: Comment */
  1633. X{
  1634. X   char *comment;
  1635. X   BUG(("RmtSetComment\n"));
  1636. X
  1637. X   BUGBSTR("File to Comment: ", global->RP.Data);
  1638. X   BUGBSTR("New Comment Str: ", global->RP.Data+FILENAMELEN);
  1639. X
  1640. X   pkt->dp_Arg2 = global->RP.Arg2;
  1641. X   MBSTR(global->RP.Data, global->fib);
  1642. X   pkt->dp_Arg3 = (LONG)MKBADDR(global->fib);
  1643. X   comment = ((char *)global->fib)+FILENAMELEN;
  1644. X   MBSTR(global->RP.Data+FILENAMELEN, comment);
  1645. X   pkt->dp_Arg4 = (LONG)MKBADDR(comment);
  1646. X
  1647. X   Dispatch(global);
  1648. X
  1649. X   global->RP.DLen = 0;
  1650. X}
  1651. SHAR_EOF
  1652. echo "End of archive 3 (of 4)"
  1653. # if you want to concatenate archives, remove anything after this line
  1654. exit
  1655.